package com.yunji.storage.service.impl;

import com.yunji.storage.bo.RepairInfoListQueryBO;
import com.yunji.storage.dao.IRepairInfoDao;
import com.yunji.storage.domain.RepairInfoDO;
import com.yunji.storage.mapper.RepairInfoMapper;
import com.yunji.storage.service.IRepairInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.storage.service.impl
 * @Title: RepairInfoServiceImpl
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-08-27 19:55:58      V1.0        HuaAo       新建类
 */
@Service
public class RepairInfoServiceImpl implements IRepairInfoService {

    @Resource
    RepairInfoMapper repairInfoMapper;

    @Resource
    IRepairInfoDao repairInfoDao;

    @Override
    public List<RepairInfoDO> search(RepairInfoListQueryBO bo) {
        return repairInfoDao.search(bo);
    }

    @Override
    public boolean delete(List<Long> infoIds) {
        if (infoIds.isEmpty()) {
            return true;
        } else {
            return repairInfoDao.removeByIds(Arrays.asList(infoIds));
        }
    }

    @Override
    public boolean create(RepairInfoDO repairInfo) {
        return repairInfoDao.save(repairInfo);
    }

    @Override
    public boolean update(RepairInfoDO repairInfo) {
        return repairInfoDao.updateById(repairInfo);
    }

    @Override
    public boolean deleteByRepairIds(Long... repairIds) {
        return repairInfoDao.removeByRepairIds(repairIds);
    }
}